package org.kabeja.dxf.entity;

import org.kabeja.dxf.DXFConstants;
import org.kabeja.dxf.helpers.Point;
import org.kabeja.math.MathUtils;

/**
 * @author shutao
 * @since 2022/4/25 9:21
 */
public class DXFSolid extends DXFEntity {
    protected Point point1 = new Point();
    protected Point point2 = new Point();
    protected Point point3 = new Point();
    protected Point point4 = new Point();

    public DXFSolid() {
        this.setLineType(this.getType());
    }

    @Override
    public Bounds getBounds() {
        Bounds var1 = new Bounds();
        var1.addToBounds(this.point1);
        var1.addToBounds(this.point2);
        var1.addToBounds(this.point3);
        var1.addToBounds(this.point4);
        return var1;
    }

    public Point getPoint1() {
        return this.point1;
    }

    public void setPoint1(Point var1) {
        this.point1 = var1;
    }

    public Point getPoint2() {
        return this.point2;
    }

    public void setPoint2(Point var1) {
        this.point2 = var1;
    }

    public Point getPoint3() {
        return this.point3;
    }

    public void setPoint3(Point var1) {
        this.point3 = var1;
    }

    public Point getPoint4() {
        return this.point4;
    }

    public void setPoint4(Point var1) {
        this.point4 = var1;
    }

    @Override
    public String getType() {
        return DXFConstants.ENTITY_TYPE_SOLID;
    }

    @Override
    public double getLength() {
        double var1 = 0.0D;
        var1 += MathUtils.distance(this.point1, this.point2);
        var1 += MathUtils.distance(this.point2, this.point4);
        var1 += MathUtils.distance(this.point4, this.point3);
        var1 += MathUtils.distance(this.point3, this.point1);
        return var1;
    }
}
